﻿@model IQueryable<USERS.CYT369.COM.MODELS.Brand.Brand>
@{
    Layout = "_MyLayout";
    ViewData["Title"] = "所有品牌";
    Dictionary<int?, USERS.CYT369.COM.MODELS.Base.City> citys = ViewBag.citys as Dictionary<int?, USERS.CYT369.COM.MODELS.Base.City>;
}
@section styles {
    <link href="~/css/brand/brand.css" rel="stylesheet" />
}
@section scripts {
    <script src="~/js/Common.js"></script>
    <script src="~/js/SystemSetting.js"></script>
    <script src="~/js/brand/brand-index.js"></script>
}

<div class="easyui-layout" fit="true">
    <div data-options="region:'north',border:false" style="overflow: hidden; padding: 5px; border-bottom: solid 1px #ddd">
        @await Html.PartialAsync("_BrandMenuHeader")
        @await Html.PartialAsync("_BrandSearchHeader")
    </div>
    <div data-options="region:'center',border:false">
        <div class="easyui-layout" fit="true">
            <div data-options="region:'center',border:false" class="min-scrollbar" style="padding:3px">
                <!-- 列表部分 -->
                <div class="brand-list">
                    @if (Model != null)
                    {
                        foreach (var brand in Model)
                        {
                            <div class="brandItem">
                                <div class="brand-item-left">
                                    <div class="serch-main-left-imgbox">
                                        <a href="">
                                            @{var img = brand.BrandImages.FirstOrDefault(); }
                                            <img width="204" height="162" src="@string.Format("{0}/{1}", USERS.CYT369.COM.UTILITY.SystemSettingService.Instance.BrandInternalBucket.HttpURL,img==null?"":img.ImagePath)" alt="">
                                        </a>
                                    </div>
                                    <div class="serch-main-left-des">
                                        <div class="heard">
                                            <h4>@brand.Name</h4>
                                            @switch (brand.ReviewResult)
                                            {
                                                case 1:
                                                    <span class="status font-color-green">审核通过</span>
                                                    break;
                                                case -1:
                                                    <span class="status font-color-red">审核未通过</span>
                                                    break;
                                                case 0:
                                                    <span class="status font-color-blue">待审核</span>
                                                    break;
                                                case -2:
                                                    <span class="status font-color-blue">草稿</span>
                                                    break;
                                            }
                                         
                                        </div>
                                        <div class="serch-main-left-title">
                                            <span class="red">@(brand.Category!=null?brand.Category.Parent.CategoryName:"")</span>
                                            <span class="orange">@(brand.Category!=null?brand.Category.CategoryName:"")</span>
                                        </div>
                                        <dl>
                                            <dt>
                                                <em>所属行业：</em>
                                                @if (brand.Category != null)
                                                {
                                                    <span>@brand.Category.CategoryName</span>
                                                }
                                            </dt>

                                            <dd>
                                                <em>门店数量：</em>
                                                <span>@brand.StoreCount 家</span>
                                            </dd>
                                        </dl>

                                        <dl>
                                            <dt>
                                                <em>加盟区域：</em>
                                                <span>
                                                    @if(brand.FranchiseRegionID!=null&&citys.ContainsKey(brand.FranchiseRegionID)){
                                                        @citys[brand.FranchiseRegionID].CityName
                                                    }
                                                    else
                                                    {
                                                        @("无")
                                                    }
                                                </span>
                                            </dt>
                                            <dd>
                                                <em>咨询人数：</em>
                                                <span>@brand.InquiryCount 人</span>
                                            </dd>
                                        </dl>
                                        <p>@brand.Brief</p>
                                    </div>
                                </div>

                                <div class="serch-main-left-right">
                                    <p class="p1">@USERS.CYT369.COM.Models.BrandHelper.GetAmountString(brand.Amount)</p>
                                    <p class="p2">
                                        <a href="~/Brand/BrandEdit/@Base64.ObjectToBase64(new {ID = brand.Id })">编辑</a>
                                        <a href="javascript:BrandDelete('@Base64.ObjectToBase64(new { ID = brand.Id })')">删除</a>
                                    </p>
                                </div>
                            </div>
                        }
                    }
                </div>

            </div>
            <div data-options="region:'south',border:false" style="height:35px;border-top:solid 1px #ddd">
                <div class="easyui-pagination" data-options="total:@ViewBag.TotalCount,pageSize:@ViewBag.PageRows,pageNumber:@ViewBag.PageNumber,onSelectPage:on_page_change"></div>
            </div>
        </div>
    </div>
</div>
